]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
contact-display: Try harder to display a meaningful name
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 30 Sep 2011 22:33:36 +0000 (00:33 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Oct 2011 18:26:38 +0000 (20:26 +0200)
We now match individuals on other properties than alias, so take
this into account when representing a contact in search results
to avoid having them show up as "Unknown".

https://bugzilla.gnome.org/show_bug.cgi?id=660580

js/ui/contactDisplay.js

index 10048af689e6e472b0639a703c03fd76664acac6..8cc46e03f9a49b3036c1976fc0823bde7bff043e 100644 (file)
@@ -26,7 +26,8 @@ function Contact(id) {
 
 Contact.prototype = {
     _init: function(id) {
-        this.individual = Shell.ContactSystem.get_default().get_individual(id);
+        this._contactSys = Shell.ContactSystem.get_default();
+        this.individual = this._contactSys.get_individual(id);
 
         this.actor = new St.Bin({ style_class: 'contact',
                                   reactive: true,
@@ -56,7 +57,12 @@ Contact.prototype = {
                                x_align: St.Align.START,
                                y_align: St.Align.MIDDLE });
 
-        let aliasText = this.individual.alias || _("Unknown");
+        let email = this._contactSys.get_email_for_display(this.individual);
+        let aliasText = this.individual.alias     ||
+                        this.individual.full_name ||
+                        this.individual.nickname  ||
+                        email                     ||
+                        _("Unknown");
         let aliasLabel = new St.Label({ text: aliasText,
                                         style_class: 'contact-details-alias' });
         details.add(aliasLabel, { x_fill: true,